package com.eastfair.auth.apollo;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import lombok.Data;

@Data
public class ApolloConfigBean {
    @ApolloConfig("JAVA.ab_config_version")
    private Config abConfigVersion;
    @ApolloConfig("FX.apollo")
    private Config yetAnotherConfig;

















//    /**
//     * ApolloJsonValue annotated on fields example, the default value is specified as empty list - []
//     * <br />
//     * jsonBeanProperty=[{"someString":"hello","someInt":100},{"someString":"world!","someInt":200}]
//     */
//    @ApolloJsonValue("${jsonBeanProperty:[]}")
//    private List<JsonBean> anotherJsonBeans;

//    //config change listener for namespace application
//    @ApolloConfigChangeListener("application")
//    private void anotherOnChange(ConfigChangeEvent changeEvent) {
//        //do something
//    }
//    //config change listener for namespaces application and FX.apollo
//    @ApolloConfigChangeListener({"application", "FX.apollo"})
//    private void yetAnotherOnChange(ConfigChangeEvent changeEvent) {
//        //do something
//    }

    //example of getting config from Apollo directly
    //this will always return the latest value of timeout
//    public int getTimeout() {
//        return config.getIntProperty("timeout", 200);
//    }


//    private static class JsonBean{
//        private String someString;
//        private int someInt;
//    }
}
